<script setup>
import { ref,onMounted } from 'vue'
import {itemsApi} from "../../../api/study";
import {ElMessage, ElMessageBox} from "element-plus";
import {useRouter} from 'vue-router'
import {useStudyStore} from '../../../stores/studystore'
import Player from './player.vue'

const store=useStudyStore()
// 我的课件 数据
const items=ref([])
// 页面打开就会执行
onMounted(()=>{
  loadData()
 
})
//查询 请求接口
const loadData=async ()=>{
  const r=await itemsApi({sid: store.student.id,cid:store.course.id});
  items.value=r.data;
}

const playRef=ref({})
</script>
<template>
  <Box>
    <div>
      <div style="float: left;width:20%">
        <el-col :span="24" v-for="ci in items" :key="ci.id">
          <el-card @click="onPlay(ci)" style="max-width: 480px;margin-top:10px" shadow="always">
            <template #header>{{ci.name}}</template>
             <div style="font-size:12px">{{ci.info}}</div>
          </el-card>
         </el-col>
        
      </div>
      <div style="float:right;width:78%;margin-left:2%">
        <Player></Player>

      </div>
    </div>
  </Box>
</template>
